{extend name="base" /}

{block name="body"}

<section class="content-header">
  <h1>
    用户列表
    <small>权限 管理</small>
  </h1>
  <ol class="breadcrumb">
    <li><a href="{:url('admin/index/index')}"><i class="fa fa-dashboard"></i> Home</a></li>
    <li class="active">用户列表</li>
  </ol>
</section>

<section class="content">
  <!-- 筛选框 -->
  <div class="box box-info">
    <div class="box-header with-border">
      <h3 class="box-title">筛选</h3>
    </div>

    <form class="form-horizontal" id="search-form">
      <div class="box-body">

        <div class="form-group">
          <label for="inputEmail3" class="col-sm-1 control-label">状态</label>
          <div class="col-sm-2">
            <select class="form-control select2" name="status" >
              <option value="">全部</option>
              <option value="1" {$status == 1? 'selected' : ''}>启用</option>
              <option value="2" {$status == 2? 'selected' : ''}>禁用</option>
            </select>
          </div>

          <label for="inputEmail3" class="col-sm-1 control-label">能否删除</label>
          <div class="col-sm-2">
            <select class="form-control select2" name="is_delete" >
              <option value="">全部</option>
              <option value="1" {$is_delete == 1? 'selected' : ''}>能</option>
              <option value="2" {$is_delete == 2? 'selected' : ''}>否</option>
            </select>
          </div>

          <label for="inputEmail3" class="col-sm-1 control-label">最后登陆</label>

          <div class="input-group col-sm-4">
            <div class="input-group-addon">
              <i class="fa fa-calendar"></i>
            </div>
            <input type="text" name="start" value="{$start}" class="form-control pull-right datepicker-style" placeholder="开始时间">
            
            <div class="input-group-addon">
              <i class="fa fa-calendar"></i>
            </div>
            <input type="text" name="stop" value="{$stop}" class="form-control pull-right datepicker-style" placeholder="结束时间">
          </div>
        </div>

        <div class="form-group">
          <label for="input3" class="col-sm-1 control-label">用户名</label>

          <div class="col-sm-10">
            <input type="text" name="username" value="{$username}" class="form-control" id="input3" placeholder="请输入用户名">
          </div>
        </div>

      </div>

      <div class="box-footer">
        <div class="row">
          <div class="col-md-1 col-md-offset-10">
            <button type="reset" class="btn btn-default btn-reset">重置</button>
          </div>
          <div class="">
            <button type="submit" class="btn btn-info">搜索</button>
          </div>
        </div>
      </div>

    </form>
  </div>


  <!-- 列表 -->
  <div class="row">
    <div class="col-xs-12">

      <div class="box">

        <div class="box-header">
        {if condition="show_auth('admin/AdminUser/add')"}
          <a href="javascript:;" data-url="{:url('add')}" proc-url="{:url('addProc')}" title="添加用户" class="btn btn-success btn-social-icon add-btn"><i class="fa fa-plus-square"></i></a>
        {/if}

        {if condition="show_auth('admin/AdminUser/batchProc')"}
          {if condition="show_auth('admin/AdminUser/delete')"}
            <a href="javascript:;" title="批量删除" class="btn btn-danger btn-social-icon batch-btn" data-title="删除" data-type="delete" data-url="{:url('batchProc')}"><i class="fa fa-trash-o"></i></a>
          {/if}

          {if condition="show_auth('admin/AdminUser/edit')"}
            <a href="javascript:;" title="批量启用" class="btn btn-success btn-social-icon batch-btn" data-title="启用" data-type="enable" data-url="{:url('batchProc')}"><i class="fa   fa-check-square"></i></a>

            <a href="javascript:;" title="批量禁用" class="btn btn-danger btn-social-icon batch-btn" data-title="禁用" data-type="disable" data-url="{:url('batchProc')}"><i class="fa fa-ban"></i></a>
          {/if}
        {/if}

          <a href="javascript:location=location" title="刷新" class="btn btn-default btn-social-icon"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span></a>
          <b style="color:#444">&nbsp;&nbsp;&nbsp;用户总数：{$info->total()}</b>
        </div>

        <div class="box-body table-responsive no-padding">
          <table class="table table-hover">
            <tr>
              <th width="3%">
                <input type="checkbox" id="checkbox-1" class="select_all">
                <label for="checkbox-1"></label>
              </th>
              <th>ID</th>
              <th>帐号</th>
              <th>登陆次数</th>
              <th>最后登陆时间</th>
              <th>状态</th>
              <th>操作</th>
            </tr>
            {volist name="info" id="v"}
            <tr class="text-c">
              <td class="text-c" width="3%"><input type="checkbox" name="release_id[]" class="ic-checkbox index-chkbox" value="{$v.id}" /></td>
              <td>{$v.id}</td>
              <td>{$v.username}</td>
              <td>{$v.login_count}</td>
              <td>{$v.last_login_time|date="Y-m-d H:i:s",###}</td>
              <td>{$v.status? '<span class="label label-success radius">启用</span>' : '<span class="label label-danger radius">禁用</span>'}</td>
              <td>
               {if condition="show_auth('admin/AdminUser/detail')"}
                <a href="javascript:;" title="详情" class="btn btn-xs btn-danger btn-social-icon details-btn" data-id="{$v.id}" data-url="{:url('detail')}"><i class="fa fa-list"></i></a>
               {/if}

                {if condition="show_auth('admin/AdminUser/edit')"}
                  <a href="javascript:;" title="编辑" data-id="{$v.id}" data-url="{:url('edit')}" proc-url="{:url('editProc')}" class="btn btn-xs btn-info btn-social-icon edit-btn"><i class="fa fa-pencil"></i></a>
                {/if}

                {if condition="show_auth('admin/AdminUser/delete')"}
                  <a href="javascript:;" title="删除" data-id="{$v.id}" data-url="{:url('delete')}" class="btn btn-xs btn-danger btn-social-icon delete-btn"><i class="fa fa-trash-o"></i></a>
                {/if}
              </td>
            </tr>
            {/volist}
          </table>
        </div>

        <div class="box-footer clearfix">
            {$info->render()}
        </div>
      </div>

    </div>
  </div>


</section>

{/block}

{block name="script"}
<script type="text/javascript" src="__AJS__/admin_user/index.js"></script>
{/block}